home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / 80X86 / DOS32V33.ZIP / API.DOC next >
Encoding:
Text File  |  1995-11-27  |  29.6 KB  |  1,026 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.                         DOS32  Version  3.2
  7.  
  8.              Applications Programming Interface (API)
  9.                          
  10.                          27 November 1995
  11.  
  12.      Copyright (C) 1994  Adam Seychell,  All Rights Reserved.
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.      This document contains detailed information of the DOS32 API
  23. with each function obeying the following rules.
  24.  
  25.   *  All services are invoked from software interrupts 31h or 21h.
  26.   *  Never call a function in a protected mode interrupt handler
  27.      unless otherwise said it is safe to do so.
  28.   *  All services will preserve registers which are not returned
  29.      with any value.
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.                     The Interrupt 31h services.
  38.  
  39. The following list of services are called from INT 31h with AX
  40. containing the function number. 
  41.  
  42.  
  43.  
  44.  
  45.                GET DOS32 VERSION AND SELECTOR VALUES        V3.00+
  46.  
  47.   IN:     AX = EE00h
  48.  
  49.  OUT:     AL = minor version  ( BCD )     currently 01
  50.           AH = major version  ( BCD )        "      03
  51.           DL = system type    1 = raw DOS
  52.                               2 = XMS
  53.                               4 = VCPI
  54.                               8 = DPMI
  55.           BX = Selector of 4GB data segment with zero base
  56.                address.
  57.  
  58.   Notes:
  59.       o   This function may be called in a protected mode
  60.           interrupt handler.
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.                    GET DOS32 ADDRESS INFORMATION            V3.01+
  70.  
  71.  IN:    AX = EE02h
  72.  
  73.  OUT:   EBX = 32bit linear address of the program segment
  74.         EDX = Total size in bytes of the programs .EXE file after
  75.                linking.
  76.         ESI = Offset address of PSP ( Program Segment Prefix )
  77.         EDI = Offset address of Program Environment
  78.         ECX = Offset address of the programs .EXE file name and
  79.                path (in ASCIZ format, i.e. terminates with a zero)
  80.          AX = Real mode segment value of the 8Kb buffer that is
  81.                used by the file read/write services.
  82.      
  83. Notes:
  84.   o  All offset addresses returned are relative to the main
  85.      program segment.
  86.   o  The .EXE file size is generally used for loading extra data
  87.      appended to the original application's .EXE file. The
  88.      application may simply seek to this position to access the
  89.      appended data. 
  90.   o  The .EXE file name pointed by ECX is actually the file name
  91.      contained in the last string of the Environment segment
  92.      pointed to by EDI.
  93.   o  The PSP address points to the original PSP set up by DOS.
  94.      Thus pointers stored in here still contain real mode
  95.      (segment:offset) values. Also this PSP address may not be the
  96.      same address returned by DOSs Int 21h AH=62h (Get PSP) since
  97.      DOS32 may of been loaded by a parent stub program.
  98.   o  Since the segment address returned in AX points to the 8Kb
  99.      buffer used by the virtualized 32bit file read/write service
  100.      (INT 21h AH=3Fh/40h) then the contents of this buffer will be
  101.      distroyed apon call to these  services. However, the
  102.      application may make temporary use of the buffer rather than
  103.      allocating a separate DOS block for transferring data between
  104.      real mode and protected mode. The near pointer of the buffer
  105.      will be equal to (16*AX - EBX)
  106.   o  This function may be called in a protected mode interrupt
  107.      handler.
  108.      
  109.  
  110.  
  111.  
  112.                     TERMINATE AND STAY RESIDENT             v3.00+
  113.  
  114.    This service will terminate the application to DOS but leaving
  115. it resident in memory.
  116.  
  117.  IN:   AX  = EE30h
  118.  
  119.  OUT:  Never returns
  120.  
  121.  Notes:
  122.   o  All memory allocated from functions AX=0EE42h (memory block)
  123.      and AX=EE41h ( DMA buffer ) will not be freed and stay
  124.      allocated.
  125.   o  This service may come in handy. Now....  what could you write
  126.      with a multi megabyte TSR ??
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.                DOS32 LOADABLE LIBRARIES (DLL files)
  135.  
  136.      The following functions are used for handling loadable
  137. library files supported by DOS32. There are three main steps
  138. necessary to use a loadable library. These may be ordered as
  139. follows; 
  140.  
  141. 1) use function EE10h to setup the library file. 
  142. 2) allocate memory block of size required by the library. 
  143. 3) use function EE11h to load library into memory.
  144. 4) the address of the library public variable can then be used to
  145.      access its code and/or data.
  146.  
  147.  
  148.  
  149.  
  150.                   SET UP A LOADABLE LIBRARY FILE             V3.2+
  151.  
  152.      This function is used to set up a DOS32 dynamic loadable
  153. library for the application to use. 
  154.  
  155.   Expects:   AX   = EE10h
  156.              EDX = Pointer to a string of the library
  157.                    path\filename. (terminates with zero)
  158.              EBX = Number of bytes to seek from beginning of file.
  159.  
  160.   Returns:
  161.                If function was successful:
  162.                Carry flag is clear.
  163.                EAX = Size of memory block required to store
  164.                      library.
  165.                EBX = size of library file in bytes.
  166.  
  167.                If function was not successful:
  168.                Carry flag is set.
  169.                   AL = error code.
  170.                        01 = Error opening or reading file.
  171.                        02 = Bad DOS32 library file.
  172.  
  173. NOTES:
  174.   o  The value returned in EAX is the size of the memory block
  175.      that must be allocated in order to load the library into
  176.      memory with function EE11h.
  177.   o  The seeking position, expected in EBX, tells DOS32 that the 
  178.      Loadable Library starts EBX bytes from the beginning of the
  179.      file.
  180.   o  The value returned in EBX is equal to the total size of the
  181.      library file when it was originally created by DLINK. Data
  182.      appended to the library file has no effect on this value.
  183.      Together with the seeking position, expected in EBX, it
  184.      allows Libraries files to be stored in middle of a larger
  185.      file, for example, the applications EXE file.
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.                            LOAD LIBRARY                      V3.2+
  200.  
  201.      This function is used to load the library file into memory.
  202. Once loaded the application can then use the libraries code/data.
  203.  
  204.   Expects:   AX   = EE11h
  205.              EDX  = Near pointer of memory block to store library.
  206.  
  207.   Returns:
  208.              If function was successful:
  209.              Carry flag is clear.
  210.              EDX  = Near pointer to the dynamic global public
  211.                     variable. 
  212.  
  213.              If function was not successful:
  214.              Carry flag is set.
  215.  
  216. Notes:
  217.   o  Never call this function without first successfully setting
  218.      up the library with function EE10h.
  219.   o  The size of the memory block used to store the library must
  220.      be equal to size returned in EAX from function EE10h.
  221.   o  Since the libraries code and data will be stored at the
  222.      address specified in EDX, it should always be aligned on a 4
  223.      byte boundary.
  224.   o  The pointer returned in EDX points to the public symbol
  225.      defined in the Loadable Library file. Typically the library
  226.      will define this public variable as array of pointers to each
  227.      function in the library. The programmer may use this common
  228.      address between the application and library for any purpose.
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.                 GET A REAL MODE CALL BACK ADDRESS 
  265.                    WITH IRET OR RETF STACK FRAME            V3.00+
  266.  
  267.      This service is used so that real mode software can call the
  268. protected mode application. This function returns a real mode
  269. address which when called (in real mode) will invoke a protected
  270. mode procedure. The real mode address may either be called with a
  271. FAR CALL or from an INT n.
  272.  
  273.  
  274.   Expects:     AX = EE20h     ( for an RETF stack frame )
  275.                AX = EE21h     ( for an IRET stack frame )
  276.                ESI ->    Offset address of the protected mode      
  277.                          procedure to be invoked when the real
  278.                          mode address is called. The procedure
  279.                          must exit with a FAR return.
  280.  
  281.   Returns:
  282.                If function was successful:
  283.                Carry flag is clear.
  284.                CX:DX =   The real mode far pointer ( SEG:OFFSET )
  285.                          to call the protected mode procedure.
  286.  
  287.                If function was not successful:
  288.                Carry flag is set.
  289. Notes:
  290.   o  This function will fail if it's called more than 30 times.
  291.   o  The protected mode procedure must exit with a FAR return
  292.      instruction.
  293.   o  The procedure is called with undefined selectors in all
  294.      segment registers ( ES,DS,FS,GS & SS ) and is not required to
  295.      preserve any segment registers it modifies.
  296.   o  EAX, EBX, ECX, EDX, ESI, EDI, EBP registers and flags will be
  297.      preserved across the mode switches.
  298.   o  This function can be used to hook a Real Mode interrupt by
  299.      setting a real mode interrupt vector to point to the real
  300.      mode address (CX:DX) returned by this function. See examples
  301.      on how this may be done.
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.                   UNDO PREVIOUS MEMORY ALLOCATION           v3.00+
  330.  
  331.  
  332.         This function will free the previously allocated memory
  333. block ( function AX =EE41h ) or DMA buffer ( function AX=EE42h )
  334. If this function is called multiple times then memory will be
  335. deallocated in reverse order to when allocated. For example, if a
  336. memory block was allocated followed by a DMA buffer then at first
  337. time this function is called the DMA buffer would be freed, a
  338. second call to this function will free the memory block, a third
  339. call will return an error ( Carry set ) because at this point no
  340. memory is being allocated.
  341.  
  342.  IN:  AX = EE40h
  343.  
  344.  OUT:  If function successful carry flag is cleared
  345.        If unsuccessful the carry flag is set
  346.  
  347.  Notes:
  348.     o     This function will fail if there is no memory allocated.
  349.     o     All memory will automatically be freed when then
  350.           application terminates.
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.            16KB BLOCK  ALLOCATION  FOR  DMA  CONTROLLER     V3.00+
  358.  
  359.        This function allocates a DMA buffer allowing the
  360. application to do DMA transfers of up to 16KB at a time.
  361.  
  362.   Expects:     AX = EE41h
  363.  
  364.   Returns:
  365.                If function was successful:
  366.                Carry flag is clear.
  367.                EBX = Physical address of a contiguous 16KB memory
  368.                     block that dose not cross a 64KB boundary and
  369.                     has a physical address in the lower 16MB.
  370.                EDX = Near pointer to the base address of the block
  371.                      relative to the main program segment.
  372.  
  373.                If function was not successful:
  374.                Carry flag is set.
  375.  
  376.  
  377. NOTES:
  378.   o  The 16Kb block will not cross a physical 64KB boundary and
  379.      will have a base address aligned on a 4 byte boundary. This
  380.      is just what DMA needs!.
  381.   o  If the carry flag is set then there was not enough memory to
  382.      allocate the DMA block otherwise the carry flag is cleared.
  383.   o  If the application needs to do use more than one DMA channel
  384.      at the same time ( e.g reading floppy disk at the same time 
  385.      as sending music to a sound card ) then a buffer could be
  386.      allocated for each channel used.
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.   o  If all available memory was allocated by the Allocate Memory
  395.      service ( AX=0EE42h ) then this function will fail. Your
  396.      application should allocate it's DMA buffers before is tries
  397.      to allocate large blocks with the AX=0EE42h function.
  398.   o  If you need to send large amounts of memory via DMA to a
  399.      device then it will have to be done in 16KB blocks. I know
  400.      this sounds very inefficient but I done tests and found that
  401.      I could not even measure the speed increase between 1Kb
  402.      blocks to 128Kb blocks. Only a noticeable slow down occurred
  403.      when transferring with blocks of 100 bytes or less. In fact
  404.      the time it takes to program the DMA controller and move a
  405.      16KB block to the buffer ( using REP MOVSD ) is under %1 of
  406.      the DMA transfer time. In other words, it will be less than
  407.      %1 slower using a buffer as opposed to transferring DMA
  408.      directly to/from the data area.
  409.  
  410.  
  411.  
  412.  
  413.  
  414.                       ALLOCATE A MEMORY BLOCK               V3.00+
  415.  
  416.         The entire application code,data and stack is initially
  417. contained in one large memory block. This service here is used for
  418. allocating extra memory blocks for the application.
  419.  
  420.  IN:  AX = EE42h
  421.       EDX = Size of the memory block requested to allocate in
  422.           bytes.
  423.  
  424. OUT:  EAX = The actual allocated size of the memory block in bytes
  425.       EDX = Near pointer to the base address of the block relative
  426.             to the main program segment.
  427.  
  428.      If the returned size was less than the requested size then
  429.      the Carry flag is set otherwise the carry flag is cleared.
  430.  
  431.  Notes:
  432.   o  The value expected in EDX will be rounded off to the next
  433.      4KB boundary.  Example, allocating 51001h bytes will actually
  434.      allocate 52000h bytes.
  435.   o  Never call this function in a interrupt handler or after
  436.      using the terminated and stay resident function ( AX=EE30h ).
  437.   o  If EAX is returned with zero then no memory was allocated and
  438.      contents of EDX are undefined.
  439.   o  The function will fail if the requested size is zero.
  440.   o  No more than 64 allocations can be made. If the application
  441.      requires a faster more versatile memory management then
  442.      please use Peter Anderson's memory sub-functions from PAL
  443.      library. See example files on how to use. This function here
  444.      is should used a minimum number of times.
  445.   o  When not running under a DPMI server ( i.e  Raw,XMS or VCPI )
  446.      then extended memory is allocated before conventional memory
  447.      is. For example, if there is no more extended memory free
  448.      then conventional memory will be allocated. In either case
  449.      DOS32 sets up the 386 page tables such that the allocated 
  450.      memory is addressed in a straight linear block when it may
  451.      actually be physically scattered throughout RAM.
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.               The Interrupt descriptor table services
  460.  
  461.  
  462.      These services allow the application to get and set vectors
  463. of the  protected mode interrupt descriptor table. The hardware
  464. interrupt  vectors will always be set the default values.  i.e
  465. IRQs 0..7 map  onto CPU interrupts 8..15 and IRQs 8..15 map onto
  466. CPU interrupts 70h..77h.
  467.          All protected mode interrupt vectors will initially
  468. reflect to the same interrupt in real mode. In other words a
  469. switched to and from real mode   is automatically made when a
  470. protected mode interrupt is called. The registers
  471. EAX,ECX,EDX,EBX,EBP,ESI,EDI and flags will be preserved across the
  472. mode switch. The exception to this rule are protected mode
  473. interrupts 0,1,3,4,5,6 and 7. These are exceptions and will
  474. terminate the program reporting with an error on the screen.
  475.      Hardware interrupt handlers will be called with undefined
  476. selectors in all data segment registers. The interrupt handler
  477. must preserve all modified general registers and segment registers
  478. before it returns from the interrupt.
  479.      The application is responsible for returning the original
  480. interrupt vectors before the application terminates. It is only
  481. necessary do to this when running under a DPMI server. However,
  482. for reliability, ALL modified interrupt vectors should be restored
  483. to their original value.
  484.  
  485.  
  486.  
  487.  
  488.  
  489.                 GET PROTECTED MODE INTERRUPT VECTOR         V3.00+
  490.  
  491.  
  492.  IN:      AX = 0204h
  493.           BL = interrupt
  494.  
  495.  OUT:     EDX = The 32 bit offset of the vector
  496.           CX =  Selector of vector
  497.  
  498.  
  499.  
  500.  
  501.  
  502.                 SET PROTECTED MODE INTERRUPT VECTOR          V3.00
  503.  
  504.  
  505.  IN:      AX = 0205h
  506.           BL = interrupt
  507.           EDX = The 32 bit offset of the vector
  508.           CX =  Selector of vector  ( must be a code selector )
  509.  
  510.  OUT:     nothing
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.                       REAL MODE CALL SERVICES
  525.  
  526.      The following three services are used for calling real mode
  527. programs  (e.g a DOS call or a device driver). Each of these
  528. services operate identically to the DPMI specification
  529. (AX=300h/301h/302h). Each function expects a pointer to a real
  530. mode call structure whish is used to passing all registers to and
  531. from the real mode switch. The format of the structure is defined
  532. as:
  533.  
  534.  
  535.                         Offset     Register
  536.  
  537.                           00h         EDI
  538.                           04h         ESI
  539.                           08h         EBP
  540.                           0Ch  Reserved by system
  541.                           10h         EBX
  542.                           14h         EDX
  543.                           18h         ECX
  544.                           1Ch         EAX
  545.                           20h         Flags
  546.                           22h         ES
  547.                           24h         DS
  548.                           26h         FS
  549.                           28h         GS
  550.                           2Ah         IP
  551.                           2Ch         CS
  552.                           2Eh         SP
  553.                           30h         SS
  554.  
  555.  
  556.  
  557.                   Simulate a Real Mode interrupt            V3.00+
  558.  
  559. IN:
  560.         AX = 0300h
  561.         BL = Interrupt number
  562.         BH = Flags
  563.              Bit 0  = 1 resets the interrupt controller and A20
  564.              line. Other flags reserved and must be 0
  565.        CX =  Number of  words to  copy from  protected mode to
  566.              real mode stack
  567.        ES:EDI = Selector:Offset of real mode call structure
  568.  
  569. OUT:
  570.       If function was successful:
  571.       Carry flag is clear.
  572.       ES:(E)DI =  Selector:Offset of  modified real mode call
  573.                   structure
  574.  
  575.       If function was not successful:
  576.        Carry flag is set.
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.        Call Real Mode Procedure With Far Return Stack Frame V3.00+
  590.  
  591. IN:     AX = 0301h
  592.         BH = Flags
  593.              Bit 0  = 1 resets the interrupt controller and A20
  594.              line. Other flags reserved and must be 0
  595.        CX =  Number of  words to  copy from  protected mode to
  596.              real mode stack
  597.        ES:EDI = Selector:Offset of real mode call structure
  598.  
  599. OUT:
  600.       If function was successful:
  601.       Carry flag is clear.
  602.       ES:EDI = Selector:Offset of  modified real mode call
  603.                structure
  604.  
  605.       If function was not successful:
  606.        Carry flag is set.
  607.  
  608.  
  609.  
  610.  
  611.           Call Real Mode Procedure With IRET Stack Frame    V3.00+
  612.  
  613. IN:   AX = 0302h
  614.       BH = Flags
  615.              Bit 0  = 1 resets the interrupt controller and A20
  616.              line. Other flags reserved and must be 0
  617.       CX =  Number of  words to  copy from  protected mode to
  618.              real mode stack
  619.       ES:EDI = Selector:Offset of real mode call structure
  620.  
  621. OUT:
  622.       If function was successful:
  623.       Carry flag is clear.
  624.       ES:EDI =  Selector:Offset of  modified real mode call
  625.                 structure
  626.  
  627.       If function was not successful:
  628.        Carry flag is set.
  629.  
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.                       PHYSICAL MEMORY MAPPING               V3.01+
  655.  
  656.      The follwing function is used to access an area of physical
  657. memory above the first 1Mb. Some devices require a region in the
  658. physical address space to transfer data. An example would be a
  659. video card in linear address mapping mode.
  660.  
  661.   IN:            AX = 0800h
  662.                  BX:CX = Physical address of memory
  663.                  SI:DI = Size of region to map in bytes
  664.  
  665.   OUT:           If function was successful:
  666.                  Carry flag is clear.
  667.                  BX:CX = Linear address that can be used to
  668.                          access the physical memory.
  669. Notes:
  670.   o  The physical memory address should not in the lowwer megabyte
  671.      Only memory above 1Mb is allowed to be mapped.
  672.   o  No more than 32Mb can be mapped with this function.
  673.   o  The address returned in BX:CX is a linear address. To
  674.      translate into an offset address subtract the program base
  675.      address ( see INT31h AX=EE02 ) with the contents of BX:CX.
  676.      
  677.  
  678.  
  679.  
  680.  
  681.  
  682.  
  683.  
  684.  
  685.  
  686.  
  687.                    The 32 bit DOS type services
  688.  
  689.      The following services are like a protected mode version of
  690. DOS's services. They are called the same way as in real mode where
  691. AH=function and invoked with INT 21h. The main differences is the
  692. use of protected mode 48bit far pointers (selector:offset) and
  693. 32bit registers rather than only 16bit registers and real mode far
  694. pointers (segment:offset). For a more detailed description of how
  695. the services work please refer to DOS programming documentation.
  696. The description below is only to show the use of 32 bit registers.
  697.  
  698. NOTE:  If an INT 21h function is called and is not described here
  699. then the interrupt is done in real mode with all the registers
  700. passed to from the call. This is also the case for any other
  701. protected mode interrupt, not just INT 21h!.
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719. ------------------------------------------------------------------
  720.                   WRITE STRING TO STANDARD OUTPUT            V3.0+
  721.      AH = 09h
  722.      DS:EDX -> '$'-terminated string
  723.  
  724. ------------------------------------------------------------------
  725.                         CREATE SUBDIRECTORY                  V3.0+
  726.      AH = 39h
  727.      DS:EDX -> Selector:Offset of ASCIZ pathname
  728. Return: CF clear if successful
  729.          AX destroyed
  730.      CF set on error
  731.          AX = error code (03h,05h)
  732.  
  733.  
  734. ------------------------------------------------------------------
  735.                         REMOVE SUBDIRECTORY                  V3.0+
  736.         AH = 3Ah
  737.         DS:EDX -> Selector:Offset ASCIZ pathname of directory to
  738.                be removed
  739. Return: CF clear if successful
  740.          AX destroyed
  741.      CF set on error
  742.              AX = error code (03h,05h,06h,10h)
  743.  
  744.  
  745. ------------------------------------------------------------------
  746.                         CHANGE SUBDIRECTORY                  V3.0+
  747.         AH = 3Bh
  748.         DS:EDX -> ASCIZ pathname to become current directory (max
  749.                64 bytes)
  750. Return: CF clear if successful
  751.          AX destroyed
  752.      CF set on error
  753.             AX = error code (03h)
  754.  
  755.  
  756. ------------------------------------------------------------------ 
  757.                       CREATE OR TRUNCATE FILE                V3.0+
  758.      AH = 3Ch
  759.      CX = file attributes
  760.      DS:EDX -> Selector:Offset ASCIZ filename
  761. Return: CF clear if successful
  762.          AX = file handle
  763.      CF set on error
  764.             AX = error code (03h,04h,05h)
  765.  
  766.  
  767. ------------------------------------------------------------------
  768.                         OPEN EXISTING FILE                   V3.0+
  769.      AH = 3Dh
  770.      AL = access and sharing modes
  771.      DS:EDX -> Selector:Offset ASCIZ filename
  772.      CL = attribute mask of files to look for (server call only)
  773. Return: CF clear if successful
  774.          AX = file handle
  775.      CF set on error
  776.             AX = error code (01h,02h,03h,04h,05h,0Ch,56h)
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784. ------------------------------------------------------------------
  785.                      READ FROM FILE OR DEVICE                V3.0+
  786.      AH = 3Fh
  787.      BX = file handle
  788.      ECX = number of bytes to read  ( may be zero )
  789.      DS:EDX -> Selector:Offset buffer for data
  790. Return: CF clear if successful
  791.          EAX = number of bytes actually read (0 if at EOF before
  792.                call)
  793.      CF set on error
  794.             AX = error code (05h,06h)
  795.  
  796.  
  797. ------------------------------------------------------------------
  798.                       WRITE TO FILE OR DEVICE                V3.0+
  799.      AH = 40h
  800.      BX = file handle
  801.         ECX = number of bytes to write
  802.         DS:EDX -> Selector:Offset data to write
  803. Return: CF clear if successful
  804.          EAX = number of bytes actually written
  805.      CF set on error
  806.             AX = error code (05h,06h)
  807.  
  808.  
  809. ------------------------------------------------------------------
  810.                             DELETE FILE                      V3.0+
  811.      AH = 41h
  812.         DS:EDX -> Selector:Offset ASCIZ filename (no wildcards )
  813. Return: CF clear if successful
  814.  
  815.         CF set on error
  816.             AX = error code (02h,03h,05h)
  817.  
  818.  
  819.  
  820. ------------------------------------------------------------------
  821.                      SET CURRENT FILE POSITION               V3.0+
  822.      AH = 42h
  823.      AL = origin of move
  824.          00h start of file
  825.          01h current file position
  826.          02h end of file
  827.      BX = file handle
  828.      EDX = offset from origin of new file position
  829. Return: CF clear if successful
  830.             EAX = new file position in bytes from start of file
  831.         CF set on error
  832.             AX = error code (01h,06h)
  833. Notes:    The normal real mode DOS function uses CX:DX as the
  834.           position of the file to seek and returns DX:AX with the
  835.           new value of the position. This protected mode version
  836.           uses EDX in place of CX:DX and uses EAX in place of
  837.           DX:AX.
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849. ------------------------------------------------------------------
  850.                         GET FILE ATTRIBUTES                  V3.0+
  851.      AX = 4300h
  852.         DS:EDX -> Selector:Offset ASCIZ filename
  853. Return: CF clear if successful
  854.             CX = file attributes
  855.  
  856.          AX = CX (DR-DOS 5.0)
  857.      CF set on error
  858.             AX = error code (01h,02h,03h,05h)
  859.  
  860.  
  861.  
  862.  
  863. -----------------------------------------------------------------
  864.                         SET FILE ATTRIBUTES                  V3.0+
  865.      AX = 4301h
  866.         CX = new file attributes
  867.         DS:EDX -> Selector:Offset ASCIZ filename
  868. Return: CF clear if successful
  869.          AX destroyed
  870.      CF set on error
  871.             AX = error code (01h,02h,03h,05h)
  872.  
  873.  
  874.  
  875.  
  876. ------------------------------------------------------------------
  877.                        GET CURRENT DIRECTORY                 V3.0+
  878.      AH = 47h
  879.      DL = drive number (00h = default, 01h = A:, etc)
  880.      DS:ESI -> Selector:Offset 64-byte buffer for ASCIZ pathname
  881. Return: CF clear if successful
  882.           AX = 0100h (undocumented)
  883.         CF set on error
  884.           AX = error code (0Fh)
  885.  
  886.  
  887.  
  888. ------------------------------------------------------------------
  889.                     LOAD AND/OR EXECUTE PROGRAM              V3.0+
  890.      AH = 4Bh
  891.      AL = type of load
  892.          00h load and execute
  893.          01h load but do not execute
  894.      DS:EDX -> ASCIZ program name (must include extension)
  895.      DS:EDI -> Program environment to copy for child process (copy
  896.                caller's environment if EDI = zero )
  897.      DS:ESI -> pointer to command tail to be copied into child's
  898.                PSP
  899. Return: CF clear if successful
  900.  
  901.         CF set on error
  902.             AX = error code (01h,02h,05h,08h,0Ah,0Bh)
  903.  
  904. Notes:    Unlike DOS's 4Bh function this does not require a
  905.           parameter block to be set up. The environment and
  906.           command tail are pointed to by DS:EDI and DS:ESI 
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.           respectively. See the examples distributed with DOS32 on
  915.           how this function may be used. It seems that MS-DOS will 
  916.           redirect the current DTA address after this function is
  917.           called. When this service is called the current DTA
  918.           address will be reset to the default area of 80h bytes
  919.           ahead the PSP address.
  920.      o    The command line string is expected in the Pascal string
  921.           format. The first byte represents the number of
  922.           characters in the string followed by the actual string .
  923.  
  924.  
  925.  
  926. ------------------------------------------------------------------
  927.                     TERMINATE WITH RETURN CODE               V3.0+
  928.      AH = 4Ch
  929.      AL = return code
  930. Return: never returns
  931.  
  932. Notes:
  933.   o  DOS32 applications MUST ALWAYS terminate with this call.
  934.   o  All memory allocated ( including DMA buffers and DOS blocks )
  935.      will automatically be freed when the application terminates
  936.      with this call.
  937.  
  938.  
  939.  
  940.  
  941. ------------------------------------------------------------------
  942.                      FIND FIRST MATCHING FILE                V3.0+
  943.      AH = 4Eh
  944.      CX = file attribute mask
  945.      DS:EDX -> ASCIZ file specification (may include path and
  946.                wildcards)
  947. Returns:  CF clear if successful
  948.                The DTA ( Disk Transfer Area ) is filled with file
  949.                information.
  950.         CF set on error
  951.             AX = Error code (02h, 03h, or 12h)
  952.  
  953. Notes:
  954.      The DTA is set to the default area which is at offset 80h
  955.      in the Program Segment Prefix (PSP). See function INT 31h
  956.      AX=EE02h for obtaining the PSP address.
  957.  
  958.  
  959.  
  960.  
  961.  
  962. ------------------------------------------------------------------
  963.                             RENAME FILE                      V3.0+
  964.      AH = 56h
  965.         DS:EDX -> ASCIZ filename of existing file (no wildcards )
  966.         ES:EDI -> ASCIZ new filename (no wildcards)
  967. Return: CF clear if successful
  968.         CF set on error
  969.             AX = error code (02h,03h,05h,11h)
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979. ------------------------------------------------------------------
  980.                        CREATE TEMPORARY FILE                 V3.0+
  981.      AH = 5Ah
  982.      CX = file attribute
  983.      DS:EDX -> ASCIZ path ending with a '\' + 13 zero bytes to
  984.           receive the generated filename.
  985. Return: CF clear if successful
  986.           AX = file handle opened for read/write in compatibility 
  987.                mode
  988.           DS:EDX -> pathname extended with generated name for
  989.                     temporary file.
  990.         CF set on error
  991.             AX = error code (03h,04h,05h)
  992.  
  993.  
  994.  
  995. ------------------------------------------------------------------ 
  996.                           CREATE NEW FILE                   V3.00+
  997.      AH = 5Bh
  998.      CX = file attribute
  999.      DS:EDX -> ASCIZ filename
  1000. Return: CF clear if successful
  1001.         AX = file handle opened for read/write in compatibility
  1002.           mode
  1003.      CF set on error
  1004.             AX = error code (03h,04h,05h,50h)
  1005.  
  1006.  
  1007.  
  1008.  
  1009.  
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016.  
  1017.  
  1018.  
  1019.  
  1020.  
  1021.                        < END OF DOS32 API >
  1022.  
  1023.  
  1024.  
  1025.  
  1026.